;
define(function(require, exports, module) {
	var base = require("base");
	var router = require("../hash/pageRouter");
	var init = function() {
		require("./top_main.css"),
			$("#head").html(require("./top_main.html"));
		initEvent();
	};

	var initEvent = function() {
		if (base.getData("sid") != null) {
			getUserInfo();
		}

		$(".navbar li a").unbind("click").click(function() {
			$(this).addClass("nav_active");
		});

		$("#publicInquire").on("mouseenter", function() {
			$(".w1367 div").css("background-color", "#E9EAEC");
			$(".w1367  div").css("display", "block");
			$(".w1367 span").css("display", "inline-block");
			$(".w1367 .bulkstockPledge1").css("display", "none");

		});

		$(".w1367Div").on("mouseleave", function() {
			$(".w1367  div").css("display", "none");
			$(".w1367 span").css("display", "none");
		});
		//		添加跳转
		$("#bulkstockGather").unbind("click").click(function() {
			location.href = "../publicInquire/publicInquireMain.html";
		});

		$("#bulkstockCollection").unbind("click").click(function() {
			location.href = "../publicInquire/publicInquireCollection.html";
		});

		$("#bulkstockPledge").unbind("click").click(function() {
			location.href = "../publicInquire/publicInquirePledge.html";
		});
	};

	var getUserInfo = function() {
		base.fnAjax({
			action: "inquireCurrentUserInfo.json",
			async: false,
			oData: {
			}, //传递参数
			fnSuccess: function(data) {
				if (data.status == 200) {
					$("#userInfo").html(data.datas[0].fullName );
					$("#userInfo").parent().append("<a href='javascript:void(0)' class='userExit'>退出</a>");
					$("#userInfo").css({
						"position": "relative",
						"top": "-30px",
						"left": "45px",
						"width": "90px"
					});
					$("#userInfo").hover(function() {
						$(this).css("cursor", "pointer");
					});
					$("#head").on("click", "#userInfo", function() {
						location.href = "../account/account.html";
					});
					if (data.datas[0].pictureUuid != null) {
						$("#headImg").attr("src", "/finance/api/v1.0/downloadFile.file?fileUuid=" + data.datas[0].pictureUuid);
						$("#headImg").attr("fileUuid", data.datas[0].pictureUuid);
					}

					$(".userExit").unbind("click").click(function() {
						base.clearData("sid"); //存sessionUuid
						base.openUrl("../login/login.html");
					});
				} else {
					//                  base.alert(2,"信息获取失败");
				}
			}
		});
	};

	return {
		init: init
	}
});